<!--
 * @Author: ChunLai
 * @Date: 2022-06-10 16:30:08
 * @LastEditTime: 2023-08-03 15:00:50
 * @Description: pdf链接打开
 * @FilePath: \0.newInsure\src\views\multipages\pdfdoc.vue
-->
<template>
  <div>
    <div class="fee-count-pre-module">
      <div id="planbook"></div>
    </div>
  </div>
</template>

<script>
import { pdfJs } from '@/utils/pdfh5';
export default {
  name: 'PdfLinkReadingPage',
  data() {
    return {
      pathLink: '',
    };
  },
  components: {},
  computed: {},
  created() {
    const query = this.$route.query || {};
    this.pathLink = decodeURIComponent(query.flink);
    let that = this;
    if (window.Pdfh5) {
      return that.initPdf();
    }
    pdfJs(function (res) {
      that.initPdf();
    });
  },
  mounted() {},
  methods: {
    initPdf() {
      this.$nextTick(() => {
        this.pdfh5 = new Pdfh5('#planbook', {
          pdfurl: this.pathLink,
        });
        let that = this;
        // 监听完成事件
        this.pdfh5.on('complete', function (status, msg, time) {
          that.pdfPageNum = this.totalNum;
        });
      });
    },
  },
};
</script>

<style lang="less" scoped>
.fee-count-pre-module {
  width: 100%;
  padding: 10px 0;
  height: 100vh;
}
</style>
